package com.lagou;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class DemoClientTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext("com.lagou");
        applicationContext.start();

        ExecutorService executorService = Executors.newFixedThreadPool(30);
        DemoClient demoClient = applicationContext.getBean(DemoClient.class);

        while (true) {
            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    demoClient.methodA();
                }
            });

            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    demoClient.methodB();
                }
            });

            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    demoClient.methodC();
                }
            });

            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
